package com.lrkj.workorder.service.impl;

import com.lrkj.common.core.domain.entity.RepairFeeScale;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import com.lrkj.workorder.mapper.RepairFeeScaleMapper;
import com.lrkj.workorder.service.IRepairFeeScaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 报修收费标准Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-04-22
 */
@Service
public class RepairFeeScaleServiceImpl implements IRepairFeeScaleService {
    @Autowired
    private RepairFeeScaleMapper repairFeeScaleMapper;

    /**
     * 查询报修收费标准
     *
     * @param id 报修收费标准ID
     * @return 报修收费标准
     */
    @Override
    public RepairFeeScale selectRepairFeeScaleById(String id) {
        return repairFeeScaleMapper.selectRepairFeeScaleById(id);
    }

    /**
     * 查询报修收费标准列表
     *
     * @param repairFeeScale 报修收费标准
     * @return 报修收费标准
     */
    @Override
    public List<RepairFeeScale> selectRepairFeeScaleList(RepairFeeScale repairFeeScale) {
        return repairFeeScaleMapper.selectRepairFeeScaleList(repairFeeScale);
    }

    /**
     * 新增报修收费标准
     *
     * @param repairFeeScale 报修收费标准
     * @return 结果
     */
    @Override
    public int insertRepairFeeScale(RepairFeeScale repairFeeScale) {
        repairFeeScale.setCreateTime(DateUtils.getNowDate());
        repairFeeScale.setId(IdUtils.simpleUUID());
        return repairFeeScaleMapper.insertRepairFeeScale(repairFeeScale);
    }

    /**
     * 修改报修收费标准
     *
     * @param repairFeeScale 报修收费标准
     * @return 结果
     */
    @Override
    public int updateRepairFeeScale(RepairFeeScale repairFeeScale) {
        repairFeeScale.setUpdateTime(DateUtils.getNowDate());
        return repairFeeScaleMapper.updateRepairFeeScale(repairFeeScale);
    }

    /**
     * 批量删除报修收费标准
     *
     * @param ids 需要删除的报修收费标准ID
     * @return 结果
     */
    @Override
    public int deleteRepairFeeScaleByIds(String[] ids) {
        return repairFeeScaleMapper.deleteRepairFeeScaleByIds(ids);
    }

    /**
     * 删除报修收费标准信息
     *
     * @param id 报修收费标准ID
     * @return 结果
     */
    @Override
    public int deleteRepairFeeScaleById(String id) {
        return repairFeeScaleMapper.deleteRepairFeeScaleById(id);
    }

    /**
     * 批量新增报修收费标准信息
     *
     * @param repairFeeScales 报修收费标准对象
     */
    public int batchAddData(List<RepairFeeScale> repairFeeScales) {
        return repairFeeScaleMapper.batchAddData(repairFeeScales);
    }
}
